import {
  Controller,
  Get,
  Post,
  Body,
  Patch,
  Param,
  Delete,
  Query,
  HttpCode,
  HttpStatus,
} from '@nestjs/common';
import { CommentService } from './comment.service';
import {
  CreateCommentDto,
  QueryCommentDto,
  UpdateCommentDto,
} from './comment.dto';
import { ApiTags, ApiOperation, ApiResponse } from '@nestjs/swagger';

@ApiTags('Product-评论管理')
@Controller('comments')
export class CommentController {
  constructor(private readonly commentService: CommentService) {}

  @Post('create')
  @ApiOperation({ summary: '创建新评论' })
  create(@Body() createCommentDto: CreateCommentDto) {
    return this.commentService.create(createCommentDto);
  }

  @Get('list')
  @ApiOperation({ summary: '评论列表' })
  findAll(@Query() queryDto: QueryCommentDto) {
    return this.commentService.findAll(queryDto);
  }

  @Get('getInfoById')
  @ApiOperation({ summary: '查询单个评论详情' })
  findOne(@Query('id') id: string) {
    return this.commentService.findOne(id);
  }

  @Post('updateInfoById')
  @ApiOperation({ summary: '更新评论（用于审核）' })
  update(@Query('id') id: string, @Body() updateCommentDto: UpdateCommentDto) {
    return this.commentService.update(id, updateCommentDto);
  }

  @Get('delete')
  @ApiOperation({ summary: '删除评论' })
  remove(@Query('id') id: string) {
    return this.commentService.remove(id);
  }
}
